/**
 * 
 * @param {*} times 时间戳
 * @param {*} showSeconds 是否展示
 * @returns 
 */
export function formDate(times, showSeconds) {
    const date = new Date(+times);
    const month = (date.getMonth() + 1) > 10 ? `${date.getMonth() + 1}` : `0${date.getMonth() + 1}`;
    const day = (date.getDate()) >= 10 ? `${date.getDate()}` : `0${date.getDate()}`;
    let str = `${date.getFullYear()}-${month}-${day}`;
    if (showSeconds) {
        const Hours = date.getHours().toString().padStart(2, '0');
        const mins = date.getMinutes().toString().padStart(2, '0');
        const secs = date.getSeconds().toString().padStart(2, '0');
        str += ` ${Hours}:${mins}:${secs}`;
    }
    return str;
}